package com.oh.core.entity;

import com.alibaba.fastjson2.JSONObject;

/**
 * 消息头，总共11个长度
 *
 */
public class HeadInfo {

    // 1-1指令
    Byte command;

    // 2-4魔数
    int magic;

    // 3-4报文长度
    int length;

    public HeadInfo(){

    }

    public HeadInfo(byte command, int magic, int length){
        this.command = command;
        this.magic = magic;
        this.length = length;
    }

    public Byte getCommand() {
        return command;
    }

    public void setCommand(byte command){
        this.command = command;
    }

    public void setMagic(int magic){
        this.magic = magic;
    }

    public int getMagic(){
        return this.magic;
    }

    public void setLength(int length){
        this.length = length;
    }

    public int getLength(){
        return length;
    }

    public String toJson(){
        return JSONObject.toJSONString(this);
    }
}
